#ifndef __REVERSE_PROXY_SERVER_H_
#define __REVERSE_PROXY_SERVER_H_

#include <wfrest/HttpServer.h>
#include <workflow/WFFacilities.h>
#include "sign.srpc.h"
#include "usrInfo.srpc.h"
#include "fileList.srpc.h"
#include "upload.srpc.h"
#include "download.srpc.h"

using namespace srpc;

// 装饰者模式 (套壳) Wrapper
class ReverseProxyServer
{
public:
    ReverseProxyServer();
    int start(unsigned port) { return m_server.start(port); }

    ReverseProxyServer& track() { m_server.track(); return *this; }
    
    void list_routes() { m_server.list_routes(); };

    void stop() { m_server.stop(); };

    void register_modules();

private:
    void register_static_resources_module();
    void register_signin_module();
    void register_signup_module();
    void register_userinfo_module();
    void register_fileupload_module();
    void register_filelist_module();
    void register_filedownload_module();

    

private:
    wfrest::HttpServer m_server;
    Sign::SRPCClient m_signClient;
    UsrInfo::SRPCClient m_usrInfoClient;
    FileList::SRPCClient m_fileListClient;
    UpLoad::SRPCClient m_upLoadClient;
    DownLoad::SRPCClient m_downLoadClient;
};

#endif
